<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录-诚品鲜智能科技有限公司</title>
    <link rel="icon" type="image/x-icon" href="${base}/img/favicon.ico">
    <link rel="stylesheet" href="${base}/css/font.css">
    <link rel="stylesheet" href="${base}/css/monkeyAdmin.css">
    <script src="${base}/layui/layui.js" charset="utf-8"></script>
</head>
<script>
    layui.use(['form','layer'], function(){
        var form = layui.form,layer = layui.layer,$ = layui.$;
        //自定义验证规则
        form.verify({
            username: function(value){
                if(value.length < 1){
                    return '用户名不能为空';
                }
            },
            password: function(value){
                if(value.length < 1){
                    return '密码不能为空';
                }
            }
        });
        //监听提交
        form.on('submit(confirmLogin)', function(data){
            var index = layer.load();
            $.ajax({
                type: "POST",
                url: "${base}/confirmLogin.html",
                data: data.field,
                dataType: "json",
                success: function(resp){
                    layer.close(index);
                    if (resp.code == 200) {
                        window.location.href = "${base}/index.html";
                    } else {
                        layer.msg(resp.errMsg,{icon: 5,anim: 6})
                    }
                },
                error: function () {
                    layer.close(index);
                    layer.msg('登录超时，请稍后再试',{icon: 5,anim: 6})
                }
            });
            return false;//不可去除，否则提交两次
        });
    });
</script>
<body class="login-bg">
<div class="login">
    <div class="message">诚品鲜智能科技有限公司</div>
    <div id="darkBannerWrap"></div>
    <form method="post" class="layui-form">
        <input name="username" placeholder="用户名" type="text" lay-verify="username" class="layui-input">
        <hr class="hr15">
        <input name="password" lay-verify="password" placeholder="密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="confirmLogin" style="width:100%;" type="submit">
        <hr class="hr20" >
    </form>
</div>
</body>
</html>